library f_component;

import 'package:flutter/material.dart';

export 'carousel_text.dart';
export 'nodata.dart';
export 'dash_line.dart';

class TPSliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
  final double max;
  final double min;
  final Color? floatColor;
  final Widget Function(double) builder;
  TPSliverPersistentHeaderDelegate({
    required this.builder,
    required this.max,
    required this.min,
    this.floatColor,
  });

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    return Container(
      color: shrinkOffset > 0 ? floatColor : Colors.white,
      child: builder(shrinkOffset),
    );
  }

  @override
  double get maxExtent => max;

  @override
  double get minExtent => min;

  @override
  bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
    return false;
  }
}
